#!/usr/bin/python
import sys
#collaborators: Sana Imam, Ryan Allan 

currentRow = [] 
overallOutput = []

for n in range(0,27):
	nextRow = []
	if n==0:
		nextRow.append(1)
	else:
		m=1 #start at the first column
		while True:

			#calculate valueToAdd
			valueToAdd = 0
			iterationsRequired = len(currentRow)
			for i in range(0,iterationsRequired): #essentially go from the left (col 1) through the nonzero values
				if currentRow[i]>=m:
					valueToAdd+=1

			#add the value directly above to get info from all rows above currentRow (this is the dynamic programming bit)
			
			if valueToAdd!=0:
					if m-1>=len(currentRow):
						pass
					else:
						valueToAdd+=currentRow[m-1]
			#print valueToAdd
			m+=1
			if valueToAdd == 0:
				break
			else:
				nextRow.append(valueToAdd)
	#print nextRow
	#we've constructed the row, now let's get our value of interest from that row
	for indexOfRow in range(0,len(nextRow)):
		if nextRow[indexOfRow]<indexOfRow:
			overallOutput.append(indexOfRow)
			break

	currentRow=nextRow
	print n
	print overallOutput

print overallOutput